class NetSearch
  def self.search(query, category=0, limit=0, province=0, county=0)
    socket = TCPSocket.new("127.0.0.1","20000")
    socket.write("#{query}:#{category}:#{province}:#{county}\n");
    line = socket.readline
    if line.size <= 1
      return Array.new
    else
      return Ad.find(line.split(":"))
    end
  end
end